﻿using System;
using System.Collections.Generic;
using Library.Linq;

namespace Library.Collections.Specialized
{
    public class WrappedOrderedEnumerable<T> : WrappedEnumerable<T>,
        IThenBy<T>
    {
        public WrappedOrderedEnumerable(Library.Linq.IOrderedEnumerable<T> enumerable)
            : base(enumerable) { }

        protected new IOrderedEnumerable<T> Wrapped
        {
            get
            {
                return (IOrderedEnumerable<T>)wrapped;
            }
        }

        public virtual Library.Linq.IOrderedEnumerable<T> ThenBy<TKey>(Func<T, TKey> keySelector)
        {
            return Library.Linq.Enumerable.ThenBy(Wrapped, keySelector);
        }

        public virtual Library.Linq.IOrderedEnumerable<T> ThenBy<TKey>(Func<T, TKey> keySelector, IComparer<TKey> comparer)
        {
            return Library.Linq.Enumerable.ThenBy(Wrapped, keySelector, comparer);
        }

        public virtual Library.Linq.IOrderedEnumerable<T> ThenByDescending<TKey>(Func<T, TKey> keySelector)
        {
            return Library.Linq.Enumerable.ThenByDescending(Wrapped, keySelector);
        }

        public virtual Library.Linq.IOrderedEnumerable<T> ThenByDescending<TKey>(Func<T, TKey> keySelector, IComparer<TKey> comparer)
        {
            return Library.Linq.Enumerable.ThenByDescending(Wrapped, keySelector, comparer);
        }
    }
}
